package com.sigmazero13.MKDummy.components;

import java.util.Map;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.sigmazero13.MKDummy.R;
import com.sigmazero13.MKDummy.models.ManaColor;

public class CrystalDisplayTextView extends CrystalDisplayView {

	private TextView redCrystals;
	private TextView blueCrystals;
	private TextView greenCrystals;
	private TextView whiteCrystals;
	
	public CrystalDisplayTextView(Context c) {
		super(c);

		commonSetup(c);
	}

	public CrystalDisplayTextView(Context c, AttributeSet attrs) {
		super(c, attrs);
		
		commonSetup(c);
	}
	
	
	@Override
	public void onCrystalsChanged(Map<ManaColor, Integer> crystals) {
		redCrystals.setText(crystals.get(ManaColor.RED).toString());
		blueCrystals.setText(crystals.get(ManaColor.BLUE).toString());
		greenCrystals.setText(crystals.get(ManaColor.GREEN).toString());
		whiteCrystals.setText(crystals.get(ManaColor.WHITE).toString());
	}
	
	
	private void commonSetup(Context c) {
		LayoutInflater inflater = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View main = inflater.inflate(R.layout.player_data_count_by_color, this, true);
		
		redCrystals = (TextView)main.findViewById(R.id.count_red);
		blueCrystals = (TextView)main.findViewById(R.id.count_blue);
		greenCrystals = (TextView)main.findViewById(R.id.count_green);
		whiteCrystals = (TextView)main.findViewById(R.id.count_white);
	}

}
